package com.ksvip.next.components.core.bean;

import java.util.List;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Setter
@Getter
@ToString
public class PageResult<T> extends Result<List<T>> {

    private static final long serialVersionUID = 1L;
    /**
     * (title = "总条数")
     */
    private long              totalCount       = 0;
    /**
     * @Schema(title = "总页数")
     */
    private int               pageSize         = 1;
    /**
     * @Schema(title = "当前页数")
     */
    private int               pageIndex        = 1;

    public static <T> PageResult data(List<T> data) {
        PageResult<T> result = new PageResult<>();
        result.setResult(data);

        return result;
    }

    public static <T> PageResult data(List<T> data, int pageSize, long totalCount) {
        PageResult<T> result = new PageResult<>();
        result.setResult(data);
        result.setPageSize(pageSize);
        result.setTotalCount(totalCount);
        return result;
    }

}
